package org.prism.reflection;

import org.junit.Test;
import org.prism.reflection.bean.Iphone;

import java.lang.reflect.Field;

public class KnowReflection {
    @Test
    public void test1() throws Exception{
        Class<Iphone> aClass = Iphone.class;
        Iphone iphone = aClass.newInstance();
        Field[] fields =
                aClass.getFields();
        for (Field f: fields) {
            f.setAccessible(true);
            System.out.println("f = " + f.getName());
        }
        Field[] declaredFields =
                aClass.getDeclaredFields();
        for (Field f: declaredFields) {
            f.setAccessible(true);
            System.out.println("f = " + f.getName());
        }

    }
}
